package com.finance.rule.bean.pojo;

import com.finance.framework.lang.BaseObject;
import com.finance.system.bean.pojo.Supplier;
import com.finance.util.DateUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 混合区间管理bean
 */
@Data
public class MixSectionRule extends BaseObject {

    private ValueRange valueRange;
    private String nickname;
    private String code;

    private Supplier supplier;
    /**
     * 运单配送类型 枚举 0配送 1上门换 2上门退
     * */
    private Integer direction;
    /**
     * 快照
     * */
    private String snapshot;
    /**
     *首件价格
     * */
    private BigDecimal firstPiecePrice;
    /**
     *拖件价格
     * */
    private BigDecimal secondPiecePrice;

    /**
     *启用时间 规则变化后不到指定时间不会直接生效
     * */
    private Date startTime;

    /**
     * 关闭时间 新规则在指定时间关闭
     * */
    private Date endTime;

    /**
     *结算类型 0投递员价
     *        1合作站点价
     *        2合作商价
     *        3大型合作商价
     * */
    private Integer settlementType;

    private String supplierCodeImport;

    private String directionImport;

    private String containLeftImport;

    private String containRightImport;

    private String settlementTypeImport;

    private String  pointLeft;

    private String  pointRight;

    private String  fixWeight;

    @Override
    public boolean equals(Object object){
        if(object instanceof MixSectionRule){
            MixSectionRule rule = (MixSectionRule) object;
            return rule.getId().equals(super.getId());
        }
        return false;
    }
    @Override
    public int hashCode(){
        return this.getId().hashCode();
    }

    public String getStartTimeStr(){
        if(this.startTime==null){
            return null;
        }
        return DateUtil.dateFormat(this.startTime);
    }

    public String getEndTimeStr(){
        if(this.endTime==null){
            return null;
        }
        return DateUtil.dateFormat(this.endTime);
    }


}
